import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
  {
    title: '角色编号',
    dataIndex: 'roleId',
  },
  {
    title: '角色名称',
    dataIndex: 'roleName',
  },
  {
    title: '权限字符',
    dataIndex: 'roleKey',
  },
  {
    title: '显示顺序',
    dataIndex: 'roleSort',
  },
  {
    title: '状态',
    dataIndex: 'status',
    format(value) {
      return ['启用', '停用'][parseInt(value)];
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'roleName',
    label: '角色名称：',
    component: 'Input',
    colProps: {
      span: 8,
    },
  },
  {
    field: 'status',
    label: '状态：',
    component: 'Select',
    componentProps: {
      options: [
        { label: '启用', value: '0' },
        { label: '停用', value: '1' },
      ],
    },
    colProps: {
      span: 8,
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: 'roleId',
    field: 'roleId',
    component: 'Input',
    show: false,
  },
  {
    field: 'roleName',
    label: '角色名称：',
    required: true,
    component: 'Input',
    rules: [
      {
        required: true,
        message: '请输入角色名称',
      },
    ],
    colProps: { span: 22 },
  },
  {
    field: 'roleKey',
    label: '权限字符：',
    component: 'Input',
    rules: [
      {
        required: true,
        message: '请输入权限字符',
      },
    ],
    colProps: { span: 22 },
  },
  {
    field: 'status',
    label: '状态：',
    component: 'RadioButtonGroup',
    defaultValue: '0',
    componentProps: {
      options: [
        { label: '启用', value: '0' },
        { label: '停用', value: '1' },
      ],
    },
    colProps: { span: 22 },
  },
  {
    field: 'roleSort',
    label: '显示顺序：',
    component: 'InputNumber',
    rules: [
      {
        required: true,
        message: '请输入显示顺序',
      },
    ],
    colProps: { span: 22 },
  },
  {
    label: '备注：',
    field: 'remark',
    component: 'InputTextArea',
    colProps: { span: 22 },
  },
  {
    label: '',
    field: 'menuIds',
    slot: 'menu',
    component: 'Input',
    colProps: { span: 22 },
  },
];
